<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
		<link rel="stylesheet" href="../../layui/css/layui.css" />
	    <link rel="stylesheet" href="../../layui/css/modules/layer/default/layer.css" />
	    <link rel="stylesheet" href="../../css/global.css">
	    <link rel="stylesheet" href="../../css/mytable.css">
	    <link rel="stylesheet" href="" id='bugcss'>
		<script type="text/javascript">
			document.querySelector('#bugcss').href = '../../layuiadmin/style/bug.css?v=1.0&code=' + new Date();
		</script>
	</head>
	<body>
		<div class="warp">
			<div class="layui-container form-main">
				<div class="layui-row main-title">
					修改人员类型
				</div>
				<div class="layui-row main-form">
					<form class="layui-form" lay-filter="test1" id="form">
						<div class="layui-form-item must">
						    <label class="layui-form-label layui-hide-xs">生产人员类型</label>
						    <div class="layui-input-block">
								<input type="hidden" name="id" id="id">
						     	<input type="text" name="typeName" id="typeName" required  lay-verify="required" placeholder="请输入生产人员类型" autocomplete="off" class="layui-input">
						    </div>
						</div>
						<div class="layui-form-item">
							<div class="layui-input-block">
								<button class="layui-btn my-btn-blue my-min-width" lay-submit lay-filter="formDemo">确认</button>
							</div>
						</div>
						<div class="layui-form-item">
							<div class="layui-input-block">
								<button class="layui-btn my-btn-blue my-min-width" onclick="javascript:history.back(-1)">返回</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</body>
</html>
<script type="text/javascript" src="../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript" src="../../layui/lay/modules/layer.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/mytable.js"></script>
<script type="text/javascript">
    $(function () {
        layui.use(['layer','form'], function(){
            var layer = layui.layer;
            var form = layui.form;

            initData(form);

            form.on('submit(formDemo)', function(data){
                var formdata = $("#form").serializeObject();
                $.ajax({
                    type : 'put',
                    url : '/tProducterTypes',
                    contentType: "application/json; charset=utf-8",
                    data : JSON.stringify(formdata),
                    success : function(data) {
                        layer.msg("修改成功", {shift: -1, time: 1000}, function(){
                            location.href = "productertype_list.html";
                        });
                    }
                });
                return false;
            });
        });
    });

    function initData(form) {
        var id = getUrlParam("id");
        if (id != "") {
            $.ajax({
                type: 'get',
                url: '/tProducterTypes/' + id,
                async: false,
                success: function (data) {
                    $("#id").val(data.id);
                    $("#typeName").val(data.typeName);
                }
            });
        }
    }
</script>